LOC Function ---------------------------------------------------------------------------- Action Returns the current position within an open file. Syntax LOC( filenumber%) Remarks The argument filenumber% is the number of an open file or device. With random-access files, the LOC function returns the number of the last record read from, or written to, the file. With sequential files, LOC returns the current byte position in the file, divided by 128. With binary mode files, LOC returns the position of the last byte read or written. For a communications device, LOC returns the number of characters in the input queue waiting to be read. The value returned depends on whether the device was opened in ASCII or binary mode. In ASCII mode, the low-level routines stop queuing characters as soon as an end-of-file is received. The end-of-file itself is not queued and cannot be read. If you attempt to read the end-of-file, BASIC generates the error message Input past end of file. In binary mode, the end-of-file character is ignored and the entire file can be read. For a PIPE device, LOC returns 1 if any data are available in the PIPE queue. Note The LOC function cannot be used on ISAM tables, or the SCRN, KYBD, or LPT n devices. See Also EOF, LOF, OPEN (File I-O) Example The following example stops the program if the current file position is beyond 50. Note that this example is incomplete. IF LOC(1) > 50 THEN STOP